export default {
    //1.设置命名空间
    namespaced: true,
    //共享数据
    state: {
        //是否显示提示框
        istoast: false,
        //提示内容
        toastmsg: '我时提示内容',
        //提示类型-图标(success,danger,warning)
        toasttype: 'success'
    },
    mutations: {
        //修改是否显示提示框
        changeistoast(state, payload) {
            state.istoast = payload.istoast,
                state.toastmsg = payload.title,
                state.toasttype = payload.type
        }
    },
    actions:{
        asyncshowtoast(context,payload){
            //显示提示框
            context.commit("changeistoast",payload);
            //自动关闭提示框
            setTimeout(()=>{
                context.commit("changeistoast",{
                    istoast:false
                });
            },2000)
        }
    }
}